#include "StdAfx.h"
#include "DataFormatManage.h"

CDataFormatManage::CDataFormatManage(void)
{

}

CDataFormatManage::~CDataFormatManage(void)
{
	
}

void CDataFormatManage::GetListManagePtr(CListManage* pListManage)
{
	m_oH3CFormat.GetListManagePtr(pListManage);
}

PACK_TYPE CDataFormatManage::GetPackType(char* pPackData)
{
	u_char cBit1 = (u_char)pPackData[0];
	u_char cBit2 = (u_char)pPackData[1];

	//printf("%02X-%02X",cBit1,cBit2);

	if (cBit1 == 0x7c && cBit2 == 0x83)
	{
		return PT_H3C_A;
	}

	return PT_NULL;
}

PACK_TYPE CDataFormatManage::GetPackTypeFromString(string strPackType)
{
    for (int i = 0;i<DATA_FORMAT_COUNT;i++)
    {
		if (strPackType == strEnumPackType[i])
		{
			return (PACK_TYPE)i;
		}	
    }

	return PT_H3C_A;
}

CDataFormat* CDataFormatManage::GetDataFormatObj(PACK_TYPE enumPackType)
{
	CDataFormat* pDataFormat = NULL;
	switch(enumPackType)
	{
	case PT_H3C_A:
		pDataFormat = (CDataFormat*)&m_oH3CFormat;
		break;
	default:
		//pDataFormat = (CDataFormat*)&m_oH3CFormat;
		break;
	}
	return pDataFormat;
}


